/**
 * CS543 HW4 Joseph Meyer
 */
package edu.src.hardware;

/**
 * A way of recording when a value was stored into
 * the Physical memory array.
 * <p>
 * The timestamp is used to find the oldest item for the LRU algorithm
 * <p>
 * @author meyer
 *
 */
public class ByteEntry {
	
	private Byte value;
	private long timestamp;
	private int index = 0;

	/**
	 * Default Constructor
	 */
	public ByteEntry(Byte value) {
		this.value = value;
		this.timestamp = System.currentTimeMillis();
	}

	/**
	 * get the value, 
	 * also update the timestamp, since this was 'used'
	 * 
	 * @return the value - Byte
	 */
	public Byte getValue() {
		timestamp = System.currentTimeMillis();
		return value;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(Byte value) {
		this.value = value;
	}

	/**
	 * @return the timestamp
	 */
	public long getTimestamp() {
		return timestamp;
	}

	/**
	 * @param timestamp the timestamp to set
	 */
	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}

	/**
	 * WARNING: Only to be used for page replacement
	 * @return the index
	 */
	public int getIndex() {
		return index;
	}

	/**
	 * WARNING: Only to be used for page replacement
	 * @param index the index to set
	 */
	public void setIndex(int index) {
		this.index = index;
	}
	
	

}
